#!/bin/bash

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}"

REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "${REPO_ROOT}"/python


if [ -n "${1}" ]; then
    START_DATE="${1}"
else
    START_DATE="$(TZ=UTC date '+%Y%m%d')"
fi

if [ -n "${2}" ]; then
    END_DATE="${2}"
else
    END_DATE=${START_DATE}
fi

source ~/miniconda3/etc/profile.d/conda.sh
conda activate coin2_motion_env

./pyrunner coin/support/feed_tool/feed_stats/app/feed_stats_motion/feed_stats_cleaner.py \
--start_date="${START_DATE}" \
--end_date="${END_DATE}" \
--interval_feed_retention=${3} 